package gr.atc.epart;

import java.util.ArrayList;

import gr.atc.epart.googlewrapper.moderator.ModeratorVote;

public class SurveyQuestionVotingEntity
{

	public class VotingInfo
	{
		private int _seriesId;
		private int _submissionId;
		private ModeratorVote _moderatorVote;
		
		public VotingInfo(int seriesId,int submissionId,ModeratorVote vote)
		{
			_seriesId = seriesId;
			_submissionId = submissionId;
			_moderatorVote = vote;
		}
		
		public int getSeriesId()
		{
			return _seriesId;
		}
		
		public int getSubmissionId()
		{
			return _submissionId;
		}
		
		public ModeratorVote getVote()
		{
			return _moderatorVote;
		}
	}
	
	
	private ArrayList<VotingInfo> _votes;
	
	public SurveyQuestionVotingEntity()
	{
		_votes = new ArrayList<VotingInfo>();
	}

	public void addVote(SurveyLinkToModerator linktoModerator, ModeratorVote moderatorVote)
	{
		_votes.add(new VotingInfo(linktoModerator.getSeriesId(),linktoModerator.getSubmissionId(),moderatorVote));
	}	

	public boolean hasVotes()
	{
		return !_votes.isEmpty();
	}
	
	public VotingInfo getVote()
	{
		VotingInfo vote = _votes.get(0);
		_votes.remove(0);
		return vote;
	}
}
